import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [
  {
  path:'/',
  component:()=> import('../views/Main/index.vue'),
  // redirect:'/home',
  children: [
    {
      path: '/home',
      name: 'Home',
      component: () => import ('../views/Home/index.vue')
  },
  {
      path: '/news',
      component: () => import ('../views/News/index.vue')
  },
  {
      path: '/goods',
      component: () => import ('../views/Goods/index.vue')
  },
  {
      path: '/about',
      component: () => import ('../views/About/index.vue')
  },
  {
      path: '/:username/article/detail/:id',
      name: 'Detail',
      component: () => import ('../views/Detail/index.vue')
        }
      ]
  },
       {
        path: '/login',
        component: () => import ('../views/Login/index.vue')
       }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
